import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 引入字体图标样式表
import '../src/assets/fonts/iconfont.css'
// 导入全局样式表
import './assets/css/global_css.css'
//导入axios的包
import axios from 'axios'
import { Message } from 'element-ui'
import TreeTable from 'vue-table-with-tree-grid'

// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// require styles 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import moment from 'moment'

axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//axios 请求拦截器 为每次请求在请求报文加上 authorization 字段
//保证拥有获取数据的权限
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

Vue.filter('dataformat', function (nowtime) {
  // return moment(nowtime).format('YYYY-MM-DD hh:mm:ss')
  return moment(nowtime).format('YYYY-MM-DD hh:mm:ss')
})

Vue.prototype.$http = axios
Vue.component('tree-table', TreeTable)
// 将富文本编辑器，注册为全局可用的组件
Vue.use(VueQuillEditor)
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
